package com.kingschan.easytag.test;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

import com.kingschan.jeasytag.sql.AbstractConnection;
import com.kingschan.jeasytag.sql.JdbcTemplete;

public class MysqlConn implements AbstractConnection{

	@Override
	public Connection getConnection() throws Exception {
		try {
            Class.forName( "com.mysql.jdbc.Driver" );
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        String userName = "root";
        String userPass = "02083486677";
        String driverName = "jdbc:mysql://localhost:3306/kingschan";
        Connection cn = null;
        try {
            cn = DriverManager.getConnection(driverName, userName, userPass );
        } catch (SQLException e) {
            e.printStackTrace();
        } 
        return cn;
	}
	public static void main(String[] args) throws Exception{
		Connection con =new MysqlConn().getConnection();
		if (null!=con) {
			System.out.println("���ӳɹ�");
			JdbcTemplete.closeDB(null, null, con);
		}else{
			System.out.println("����ʧ��");
		}
	}
}
